'use strict';

const Controller = require('egg').Controller;

class PostsController extends Controller {
    // 列表页
    async index() {
        console.log('>>> index')
        this.ctx.body = {
            msg: 'ok',
            data: '列表页'
        };
    };

    // 新增表单页
    async new() {
        console.log('>>> new')
        this.ctx.body = {
            msg: 'ok',
            data: '新增表单页'
        };
    };

    // 新增逻辑
    async create() {
        console.log('>>> create')
        this.ctx.body = {
            msg: 'ok',
            data: '新增逻辑'
        };
    };

    // 详情页
    async show() {
        console.log('>>> show')
        let id = this.ctx.params.id;
        this.ctx.body = {
            msg: 'ok',
            data: '详情页,id=' + id
        };
    };

    // 编辑表单页
    async edit() {
        console.log('>>> edit')
        let id = this.ctx.params.id;
        this.ctx.body = {
            msg: 'ok',
            data: '编辑表单页,id=' + id
        };
    };

    // 更新逻辑
    async update() {
        console.log('>>> update')
        let id = this.ctx.params.id;
        this.ctx.body = {
            msg: 'ok',
            data: '更新逻辑, id=' + id
        };
    };

    // 删除逻辑
    async destroy() {
        console.log('>>> destroy')
        let id = this.ctx.params.id;
        this.ctx.body = {
            msg: 'ok',
            data: '删除逻辑, id=' + id
        };
    };
}

module.exports = PostsController;
